import 'package:flutter/material.dart';
import 'package:flutter_demo/widgets/appbar.dart';
import 'package:flutter_demo/widgets/base_scaffold.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class SharePage extends StatelessWidget {
  SharePage({Key? key}) : super(key: key);
  final SharePageController vm = Get.put(SharePageController());

  @override
  Widget build(BuildContext context) {
    return BaseScaffold(
      appBar: MyAppBar(
        title: '分享好友',
        color: Colors.white,
        backgroundColor: const Color.fromRGBO(61, 119, 255, 1),
        flexibleSpace: Container(
          decoration: BoxDecoration(
            gradient: LinearGradient(colors: [
              Color.fromRGBO(61, 119, 255, 1),
              Color.fromRGBO(61, 119, 255, 1),
              Color.fromRGBO(61, 125, 255, 1),
            ], begin: Alignment.centerLeft, end: Alignment.centerRight),
          ),
        ),
      ),
      body: Column(
        children: [
          Stack(
            alignment: AlignmentDirectional.topCenter,
            children: [
              Stack(
                alignment: AlignmentDirectional.topCenter,
                children: [
                  Image.asset(
                    'assets/images/share/share.png',
                    width: 1.sw,
                    height: 1206.w,
                    fit: BoxFit.cover,
                  ),
                  Positioned(
                    bottom: 159.w,
                    child: Row(
                      // mainAxisSize: MainAxisSize.max,

                      children: [
                        renderQrcodeWidget(title: 'Andriod'),
                        SizedBox(
                          width: 60.w,
                        ),
                        renderQrcodeWidget(title: 'ios'),
                        SizedBox(
                          width: 60.w,
                        ),
                        renderQrcodeWidget(title: '微信小程序'),
                      ],
                    ),
                  ),
                ],
              ),

              ///卡片按钮
              Positioned(
                bottom: 46.w,
                child: SizedBox(
                  width: 479.w,
                  height: 80.w,
                  child: ElevatedButton(
                    onPressed: () {},
                    style: ButtonStyle(
                      backgroundColor: MaterialStateProperty.all(
                          Color.fromRGBO(255, 188, 27, 1)),
                      shape: MaterialStateProperty.all(RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(40.w))),
                    ),
                    child: Text(
                      '分享卡片',
                      style: TextStyle(color: Colors.white, fontSize: 30.sp),
                    ),
                  ),
                ),
              ),
            ],
          ),

          ///延伸卡片背景色部分
          Expanded(
              child: Container(
            decoration: const BoxDecoration(
                gradient: LinearGradient(
                    begin: Alignment.centerLeft,
                    end: Alignment.centerRight,
                    colors: [
                  Color.fromRGBO(61, 193, 255, 1),
                  Color.fromRGBO(63, 205, 255, 1),
                  Color.fromRGBO(63, 212, 255, 1)
                ])),
          ))
        ],
      ),
    );
  }

  Column renderQrcodeWidget({required String title}) {
    return Column(
      children: [
        Container(
          width: 146.w,
          height: 144.w,
          color: Colors.red,
        ),
        SizedBox(
          height: 12.w,
        ),
        Text(
          title,
          style: TextStyle(
              fontSize: 24.sp,
              fontWeight: FontWeight.w500,
              color: Color.fromRGBO(57, 57, 57, 1),
              height: 1,
              leadingDistribution: TextLeadingDistribution.even),
        )
      ],
    );
  }
}

class SharePageController extends GetxController {}
